#! /bin/sh
#
# nstat-firewall
#
# Version:      20081203
#
### BEGIN INIT INFO
# Provides:          nstatfirewall
# Required-Start:    $local_fs $network postgresql firewall
# Required-Stop:     $local_fs $network
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: NStat Firewall
### END INIT INFO

NAME="nstat-firewall"

. /lib/lsb/init-functions

PATH=/bin:/usr/bin:/sbin:/usr/sbin


start () {
        /etc/nstat-firewall reset >/dev/null
        cd /home/kreved/nstat/v2/nstat
        su www-data -c "./manage.py rebuildfirewall" >>/var/log/firewall 2>&1 || true
        return 0
}

stop () {
        return 0
}

case "$1" in
    start)
        log_daemon_msg "NStat Firewall" "firewall"
        if start ; then
                log_end_msg $?
        else
                log_end_msg $?
        fi
        ;;
    stop)
        log_daemon_msg "Stopping NStat Firewall" "firewall"
        if stop ; then
                log_end_msg $?
        else
                log_end_msg $?
        fi
        ;;
    reload|force-reload)
        ;;
    restart)
        log_daemon_msg "Restarting NStat Firewall" "firewall"
        stop
        if start ; then
                log_end_msg $?
        else
                log_end_msg $?
        fi
        ;;
    *)
        echo "Usage: /etc/init.d/$NAME start"
        exit 3
        ;;
esac

exit 0
